<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" placeholder="请输入照片数量">
<input type="button" value="kun" onclick="f(1)">
<input type="button" value="苍老师" onclick="f(2)">
<hr>
<script>
    let t = document.querySelector("input")
    function f(x) {
        if(isNaN(t.value)){
            t.innerText = "输入错误!";
            return;
        }
        for (let i = 0; i < t.value; i++) {
            let url = x==1?"a.png":"b.jpg";
            let img = document.createElement("img");
            img.src = url;
            document.body.append(img);
        }
    }
</script>
</body>
</html>